package com.chilli.cosima.action.login;

import java.io.ByteArrayInputStream;

import com.chilli.cosima.utils.RandomNumUtil;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class RandomCodeAction extends ActionSupport
{

	/**
	 * 注释内容
	 */
	private static final long serialVersionUID = 5488369241006129890L;

	private ByteArrayInputStream inputStream;

	public String execute() throws Exception
	{
		RandomNumUtil rdnu = RandomNumUtil.Instance();
		this.setInputStream(rdnu.getImage());// 取得带有随机字符串的图片
		ActionContext.getContext().getSession().put("random", rdnu.getString());// 取得随机字符串放入HttpSession
		return SUCCESS;
	}

	public void setInputStream(ByteArrayInputStream inputStream)
	{
		this.inputStream = inputStream;
	}

	public ByteArrayInputStream getInputStream()
	{
		return inputStream;
	}

}
